/*    
 * Copyright (c) 2013 ISoftStone, Inc.
 * All right reserved.
 *
 * 文件名：      ReceiptDisburseStatementServiceImpl.java
 * 作者:     Jacky Wang
 * 创建日期： 2013-8-15 上午10:13:28
 * 版本：           
 *
 */
package com.isoftstone.industry.aaa.core.service.assist.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.isoftstone.industry.persistance.bean.Account;
import com.isoftstone.industry.persistance.bean.AccountBook;
import com.isoftstone.industry.persistance.bean.ReceiptDisburseStatement;
import com.isoftstone.industry.aaa.core.dao.assist.ReceiptDisburseStatementDao;
import com.isoftstone.industry.aaa.core.service.assist.IReceiptDisburseStatementService;
import com.isoftstone.modules.core.persistence.IGenericDao;
import com.isoftstone.modules.core.service.impl.GenericServiceImpl;
import com.isoftstone.modules.core.utils.DateUtils;

/**
 * @author jacky
 */
@Service
public class ReceiptDisburseStatementServiceImpl extends GenericServiceImpl<ReceiptDisburseStatement, String> implements
		IReceiptDisburseStatementService
{

	@Resource
	private ReceiptDisburseStatementDao	rdsDao;

	@Override
	public IGenericDao<ReceiptDisburseStatement, String> getDao()
	{
		return rdsDao;
	}

	@Override
	public ReceiptDisburseStatement checkInDisburse(String accountId, String acctBookId, double disburse, double balance, String memo, String memo1)
	{
		ReceiptDisburseStatement entity = new ReceiptDisburseStatement();
		entity.setType(ReceiptDisburseStatement.Type.DISBURSE);
		Account account = new Account();
		account.setId(accountId);
		entity.setAccount(account);
		
		AccountBook acctBook = new AccountBook();
		acctBook.setId(acctBookId);
		entity.setAccountBook(acctBook);
		
		entity.setDisburse(disburse);
		entity.setBalance(balance);
		entity.setMemo(memo);
		entity.setMemo1(memo1);
		entity.setCreateby("系统");
		entity.setCreateTime(DateUtils.getCurrentTimestamp());
		entity.setInvoiced(true);
		
		return rdsDao.save(entity);
	}

}
